package dujiu.luogu.branch;

import java.util.Scanner;

public class P1424 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int n = scanner.nextInt();
        int sum = 0;
        final int everyDay = 250;
        for (int i = 0; i < n; i++) {
            if (x!= 6 && x!=7){
                sum += everyDay;
            }
            if (x == 7){
                x=1;
            }else {
                x++;
            }

        }
        System.out.println(sum);
    }
}
